<?php

namespace app\admin\model\stock;

use think\Model;

class K extends Model
{
    // 表名
    protected $name = 'stock_k';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'adjustflag_text',
        'tradestatus_text',
        'isST_text'
    ];
    

    
    public function getAdjustflagList()
    {
        return ['1' => __('Adjustflag 1'),'2' => __('Adjustflag 2'),'3' => __('Adjustflag 3')];
    }     

    public function getTradestatusList()
    {
        return ['1' => __('Tradestatus 1'),'0' => __('Tradestatus 0')];
    }     

    public function getIsstList()
    {
        return ['1' => __('Isst 1'),'0' => __('Isst 0')];
    }     


    public function getAdjustflagTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['adjustflag']) ? $data['adjustflag'] : '');
        $list = $this->getAdjustflagList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getTradestatusTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['tradestatus']) ? $data['tradestatus'] : '');
        $list = $this->getTradestatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getIsstTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['isST']) ? $data['isST'] : '');
        $list = $this->getIsstList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
